View Javadoc
1 package net.sf.fastxmldb.impl; 2 3 import org.w3c.dom.Node; 4 import org.xml.sax.ContentHandler; 5 import org.xmldb.api.base.Collection; 6 import org.xmldb.api.base.ErrorCodes; 7 import org.xmldb.api.base.XMLDBException; 8 import org.xmldb.api.modules.XMLResource; 9 10 /*** 11 * 12 * @author jbirchfield 13 */ 14 public class LocalXMLResource implements XMLResource { 15 16 /*** 17 * The XMLResource type 18 */ 19 public static final String RESOURCE_TYPE = "XMLResource"; 20 21 private String content = null; 22 private String docId = null; 23 24 /*** 25 * Default COnstructor 26 * @param docId the document id 27 */ 28 public LocalXMLResource(String docId) { 29 this.docId = docId; 30 } 31 32 /*** 33 * not yet implemented 34 * @see org.xmldb.api.modules.XMLResource#getContentAsDOM() 35 */ 36 public Node getContentAsDOM() throws XMLDBException { 37 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED); 38 } 39 /*** 40 * not yet implemented 41 * @see org.xmldb.api.modules.XMLResource#getContentAsSAX(ContentHandler) 42 */ 43 public void getContentAsSAX(ContentHandler contentHandler) 44 throws XMLDBException { 45 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED); 46 } 47 48 /*** 49 * 50 * @see org.xmldb.api.modules.XMLResource#getDocumentId() 51 */ 52 public String getDocumentId() throws XMLDBException { 53 return docId; 54 } 55 56 /*** 57 * not yet implemented 58 * @see org.xmldb.api.modules.XMLResource#setContentAsDOM(Node) 59 */ 60 public void setContentAsDOM(Node node) throws XMLDBException { 61 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED); 62 } 63 64 /*** 65 * not yet implemented 66 * @see org.xmldb.api.modules.XMLResource#setContentAsSAX() 67 */ 68 public ContentHandler setContentAsSAX() throws XMLDBException { 69 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED); 70 } 71 72 /*** 73 * 74 * @see org.xmldb.api.base.Resource#getContent() 75 */ 76 public Object getContent() throws XMLDBException { 77 return content; 78 } 79 80 /*** 81 * 82 * @see org.xmldb.api.base.Resource#getId() 83 */ 84 public String getId() throws XMLDBException { 85 return docId; 86 } 87 88 /*** 89 * not yet implemented 90 * @see org.xmldb.api.base.Resource#getParentCollection() 91 */ 92 public Collection getParentCollection() throws XMLDBException { 93 throw new XMLDBException(ErrorCodes.NOT_IMPLEMENTED); 94 } 95 96 /*** 97 * 98 * @see org.xmldb.api.base.Resource#getResourceType() 99 */ 100 public String getResourceType() throws XMLDBException { 101 return LocalXMLResource.RESOURCE_TYPE; 102 } 103 104 /*** 105 * 106 * @see org.xmldb.api.base.Resource#setContent(Object) 107 */ 108 public void setContent(Object o) throws XMLDBException { 109 if (!(o instanceof String)) { 110 throw new XMLDBException(ErrorCodes.WRONG_CONTENT_TYPE); 111 } 112 content = (String) o; 113 } 114 115 /*** 116 * 117 * @see java.lang.Object#equals(Object) 118 */ 119 public boolean equals(Object o) { 120 if (this == o) { 121 return true; 122 } 123 if (!(o instanceof LocalXMLResource)) { 124 return false; 125 } 126 127 final LocalXMLResource localXMLResource = (LocalXMLResource) o; 128 129 if (content != null 130 ? !content.equals(localXMLResource.content) 131 : localXMLResource.content != null) { 132 return false; 133 } 134 if (docId != null 135 ? !docId.equals(localXMLResource.docId) 136 : localXMLResource.docId != null) { 137 return false; 138 } 139 140 return true; 141 } 142 143 }

This page was automatically generated by Maven